<%@ page import="top.lbqaq.pojo.Material" %>
<%@ page import="java.util.List" %>
<%@ page import="top.lbqaq.domain.PageBean" %><%--
  Created by IntelliJ IDEA.
  User: 12197
  Date: 2021/11/21
  Time: 13:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%@include file="/jsp/common/head.jsp" %>
<div class="card-header d-flex justify-content-between">
    <div class="header-title">
        <h4 class="card-title">
            材料验收入库
        </h4>
    </div>
</div>
<p style="color: red;">${message}</p>
<div class="card-body">
    <div class="row">
        <div class="col-6">
            <form action="${pageContext.request.contextPath}/material?methodd=Inselect" method="post">
                <div class="form-group">
                    <label for="mingcheng">材料名称</label>
                    <input id="mingcheng" name="mingcheng"  value="${materialList.name}" required class="form-control" type="text" placeholder="请输入验证材料的名称">
                </div>
                <input type="submit" class="btn btn-primary btn-sm" value="查询"/>
            </form>
        </div>
    </div>

    <table class="table" style="text-align:center;">
        <thead>
        <tr class="ligth">
            <th scope="col">材料类别</th>
            <th scope="col">材料名称</th>
            <th scope="col">单位</th>
            <th scope="col">单价</th>
            <th scope="col">数量</th>
            <th scope="col">金额</th>
            <th scope="col">供应商</th>
            <th scope="col">入库日期</th>
            <th scope="col">备注</th>
            <th scope="col"></th>
        </tr>
        </thead>
        <tbody>
        <c:forEach var="material" items="${materialList.list}">
            <tr>
                <th scope="col">${material.materialCategory}</th>
                <th scope="col">${material.materialName}</th>
                <th scope="col">${material.materialUnit}</th>
                <th scope="col">${material.materialUnitPrice}</th>
                <th scope="col">${material.materialInQuantity}</th>
                <th scope="col">${material.materialInAmount}</th>
                <th scope="col">${material.supplyCompany}</th>
                <th scope="col">${material.materialInDate}</th>
                <th scope="col">${material.materialInRemark}</th>
                <th>
                    <a href="/material?methodd=insert&&name=${material.materialName}&&date=${material.materialInDate}"  class="btn btn-primary btn-sm">入库</a>
                </th>
            </tr>
        </c:forEach>
        </tbody>
    </table>
    <c:if test="${materialList!=null}">
        <div>
            <nav aria-label="Page navigation">
                <ul  class="col-6 pagination justify-content-end">
                    <c:if test="${materialList.currentPage==1}">
                        <li class="page-item">
                            <a class="page-link" href="${pageContext.request.contextPath}/material?methodd=Inselect&&currentPage=1&&mingcheng=${materialList.name}"
                               aria-label="Previous">
                                <span aria-hidden="true">&laquo;</span>
                            </a>
                        </li>
                    </c:if>

                    <c:if test="${materialList.currentPage!=1}">
                        <li class="page-item">
                            <a  class="page-link" href="${pageContext.request.contextPath}/material?methodd=Inselect&&currentPage=${materialList.currentPage-1}&&mingcheng=${materialList.name}"
                                aria-label="Previous">
                                <span aria-hidden="true">&laquo;</span>
                            </a>
                        </li>
                    </c:if>

                    <c:forEach begin="1" end="${materialList.totalPage}" var="i">
                        <li class="page-item">
                            <a class="page-link" href="${pageContext.request.contextPath}/material?methodd=Inselect&&mingcheng=${materialList.name}&&currentPage=${i}">${i}</a>
                        </li>
                    </c:forEach>

                    <c:if test="${materialList.currentPage==materialList.totalPage}">
                        <li class="page-item">
                            <a  class="page-link" href="${pageContext.request.contextPath}/material?methodd=Inselect&&currentPage=${materialList.totalPage}&&mingcheng=${materialList.name}"
                                aria-label="Next">
                                <span aria-hidden="true">&raquo;</span>
                            </a>
                        </li>
                    </c:if>

                    <c:if test="${materialList.currentPage!=materialList.totalPage}">
                        <li class="page-item">
                            <a class="page-link" href="${pageContext.request.contextPath}/material?methodd=Inselect&&currentPage=${materialList.currentPage+1}&&mingcheng=${materialList.name}"
                               aria-label="Next">
                                <span aria-hidden="true">&raquo;</span>
                            </a>
                        </li>
                    </c:if>

                    <div class="col-8">
                        当前为第${materialList.currentPage}/${materialList.totalPage}页，共${materialList.totalCount}条数据
                    </div>
                </ul>
            </nav>
        </div>
    </c:if>

</div>

<%@include file="/jsp/common/footer.jsp" %>
